﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;


namespace Kinect_Dance.Screens
{
    class MainMenuScreen : Microsoft.Xna.Framework.Game
    {

        private static MainMenuScreen instance = null;
        public static MainMenuScreen getInstance(MainGame g)
        {
            if (instance == null)
            {
                instance = new MainMenuScreen(g);
            }
            return instance;
        }

        Texture2D mBackgroundTexture;
        KeyboardState mLastKeyboardState;
        int starterMenuX = 320;
        int starterMenuY = 450;
        int menuJump = 40;
        Utils.SoundManager soundManager;
        bool mFlagSound;
        SoundEffect switchMenu;
        SoundEffect selectMenu;
        SpriteBatch sp;
        MainGame mGame;

        public MainMenuScreen(MainGame g)
        {
            this.mGame = g;
            mBackgroundTexture = g.Content.Load<Texture2D>("Images/bg_mainmenu");
        }

        protected override void Draw(GameTime gameTime)
        {
            sp.Begin();
            sp.Draw(mBackgroundTexture, new Vector2(0, 0), Color.White);
            sp.End();
            base.Draw(gameTime);
        }

        protected override void Initialize()
        {
            base.Initialize();
        }

        protected override void LoadContent()
        {
            base.LoadContent();
        }

        protected override void Update(GameTime gameTime)
        {
            KeyboardState keyState = Keyboard.GetState();
            if (keyState.IsKeyDown(Keys.Enter) && mLastKeyboardState.IsKeyUp(Keys.Enter))
            {
                mGame.startGame();
            }

            mLastKeyboardState = keyState;
            base.Update(gameTime);
        }

        public void gameUpdate(GameTime gameTime)
        {
            Update(gameTime);
        }

        public void gameDraw(GameTime gameTime, SpriteBatch sp)
        {
            this.sp = sp;
            Draw(gameTime);
        }
    }
}
